const MeshEdit = {
	namespaced: true,
	state: () => ({
		//当前模型
		uploadModel: {},
		modelApi: {},
		//当前材质
		selectMesh: {},
		videoSrc: '',
		audioSrc: '',
		imgSrc: '',
		// 当前drag拖拽类型
		dragType: '',
		db: {},
		isEditScene:sessionStorage.getItem("IS_EDIT_SCENE") ||  false
	}),
	mutations: {
		setEditScene(state,editScene){
			state.isEditScene = editScene;
			sessionStorage.setItem("IS_EDIT_SCENE",editScene)
			
		},
		setUploadModel(state, uploadModel) {
			state.uploadModel = uploadModel
			// console.log(uploadModel,'setUploadModel----meshEdit')
		},
		setModelApi(state, modelApi) {
			state.modelApi = modelApi
			// console.log(modelApi,'setModelApi')
		},
		selectMeshAction(state, selectMesh) {
			// console.log(selectMesh, 'selectMesh---selectMeshAction');
			if (Object.keys(selectMesh).length === 0) {
				state.videoSrc = '';
				state.audioSrc = '';
				state.imgSrc = '';
			}
			state.selectMesh = selectMesh
			if (selectMesh.videoSrc || selectMesh.videoSrc == '') {
				state.videoSrc = selectMesh.videoSrc
			}
			if (selectMesh.audioSrc || selectMesh.audioSrc == '') {
				state.audioSrc = selectMesh.audioSrc
			}
			if (selectMesh.imgSrc || selectMesh.imgSrc == '') {
				state.imgSrc = selectMesh.imgSrc
			}
			// console.log(selectMesh, 'selectMeshAction---selectMesh')
		},
		changeDragType(state, dragType) {
			state.dragType = dragType
		},
		setDbApi(state, db) {
			state.db = db
		}
	},
	getters: {
		selectMeshUuid: (state) => state.selectMesh.uuid
	},
	actions: {

	}
}
export default MeshEdit